<template>
  <div class="musicList">
    <div class="musicTop">
      <div class="musicLeft">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-24gl-playCircle"></use>
        </svg>
        <span>播放全部(共{{ musicList.length }})</span>
      </div>
      <div class="musicRight">
        <div class="subsic">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-jiahao"></use>
          </svg>
          <span>收藏{{ subscribedCount }}</span>
        </div>
      </div>
    </div>
    <div class="musicContent" v-for="(item, index) in musicList" :key="item">
      <div class="musicLeft" @click="playMusic(index)">
        <div class="musicIndex">{{ index + 1 }}</div>
        <div class="musicArr">
          <div class="musicName">{{ item.name }}</div>
          <div
            class="musicAction"
            v-for="(item1, index1) in item.ar"
            :key="index1"
          >
            <span>{{ item1.name }}</span>
          </div>
        </div>
      </div>
      <div class="musicRight">
        <div class="musicMv" v-if="item.mv != 0">
          <svg class="icon" aria-hidden="true" @click="goMv(item.mv)">
            <use xlink:href="#icon-shipin"></use>
          </svg>
        </div>
        <div class="musicMun">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-caidan"></use>
          </svg>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { mapMutations } from "vuex";
export default {
  setup(props) {},
  props: ["musicList", "subscribedCount"],
  methods: {
    ...mapMutations(["updataPlayList", "updataMusicIndex"]),
    playMusic(id) {
      //传递歌曲新
      this.updataPlayList(this.musicList);
      //修改数据id
      this.updataMusicIndex(id);
    },
    goMv(res) {
      console.log("11", res);
      this.$store.commit("updataMvid", res);
      //页面跳转
      this.$router.push("/MusicMv");
    },
  },
};
</script>
<style lang="less" scoped>
.musicList {
  width: 100%;
  height: 10rem;
  background-color: #fff;
  margin-top: 0.2rem;
  border-top-right-radius: 0.4rem;
  border-top-left-radius: 0.4rem;
  .musicTop {
    width: 100%;
    height: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .musicLeft {
      display: flex;
      align-items: center;
      padding: 0 0.2rem;
      span {
        padding-left: 0.3rem;
        font-size: 0.35rem;
        font-weight: 900;
      }
    }
    .musicRight {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0 0.2rem;
      .subsic {
        width: 2.4rem;
        border-radius: 0.6rem;
        height: 0.6rem;
        background-color: rgb(238, 37, 37);
        color: #fff;
        display: flex;
        align-items: center;
        span {
          padding-left: 0.1rem;
          font-size: 0.3rem;
        }
        .icon {
          font-size: 3rem;
          fill: #fff;
        }
      }
    }
  }
  .musicContent {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0.2rem;
    .musicLeft {
      display: flex;
      justify-content: space-around;
      align-items: center;
      .musicArr {
        display: flex;
        flex-direction: column;
        justify-content: space-around;

        .musicName {
          padding: 0 0.4rem;
          font-size: 0.3rem;
          font-weight: 900;
        }
        .musicAction {
          color: #a69e9e;
          padding: 0 0.4rem;
          span {
            display: flex;
            flex-direction: row;
          }
        }
      }
    }
    .musicRight {
      display: flex;
      .musicMv {
        padding: 0 0.2rem;
        .icon {
          fill: #a69e9e;
        }
      }
      .musicMum {
        .icon {
          fill: #a69e9e;
        }
      }
    }
  }
}
</style>
